package com.zyj.guava.partition;

import lombok.Data;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Order {

    public static void main(String[] args) {
        List<A> list = IntStream.range(0, 10).boxed().map(n -> {
            A a = new A();
            a.n1 = n % 2;
            a.n2 = (n * 7) % 10;
            return a;
        }).collect(Collectors.toList());
        list.forEach(System.out::println);

        System.out.println("--------------");

        List<A> list2 = list.stream().sorted(
                Comparator.comparing(A::getN1).reversed().thenComparing(
                    Comparator.comparing(A::getN2).reversed()
                )
        ).collect(Collectors.toList());
        list2.forEach(System.out::println);


    }

    @Data
    static class A {
        private Integer n1;
        private Integer n2;
    }
}
